﻿using System.Collections.ObjectModel;
using System.Linq;

namespace Northwind.ViewModel
{
    public class OrdersViewModel
    {
        public ObservableCollection<OrderViewModel> 
            Orders { get; set; }

        public OrdersViewModel(
            Model.Customer model,
            IOrderViewModelFactory orderViewModelFactory)
        {
            Orders = new ObservableCollection<OrderViewModel>(
                model.Orders.Select(o =>
                    orderViewModelFactory
                        .CreateInstance(o, model)));
        }
    }
}